<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>轮播图管理</title>
	<meta name="decorator" content="default"/>
	<style type="text/css">
	.BoxDiv{
			position:fixed;
			width:300px;
			height:326px;
			background:#f5f5f5;
			top:10%;
			left:25%;
			margin:0 auto;
			border:1px solid #CCC;
			box-shadow:3px 3px 10px 4px #DDD;
		}
	</style>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		function showImgDiv(url){
			$("#showImg").attr("src",url);
			$("#showImgDiv").show();
		}
		function closeImgDiv(){
			$("#showImg").attr("src","");
			$("#showImgDiv").hide();
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/sys/carousel/">轮播图列表</a></li>
		<li><a href="${ctx}/sys/carousel/form?id=${carousel.id}">轮播图<shiro:hasPermission name="sys:carousel:edit">${not empty carousel.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="sys:carousel:edit">查看</shiro:lacksPermission></a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="carousel" action="${ctx}/sys/carousel/" method="post" class="">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
	</form:form>
	<div style="display:none;">
		<sys:message content="${message}"/>
	</div>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>序号</th>
				<th>排序</th>
				<th>链接</th>
				<th>图片</th>
				<th>备注</th>
				<shiro:hasPermission name="sys:carousel:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="carousel" varStatus="index">
			<tr>
				<td>${index.index+1 }</td>
				<td>${carousel.sort }</td>
				<c:if test="${empty carousel.url}">
				<td>--</td>
				</c:if>
				<c:if test="${not empty carousel.url}">
					<td><a href="${carousel.url}">${carousel.url}</a></td>
				</c:if>
				<td><a href="javascript:;" onclick="showImgDiv('${carousel.img}')">查看</a></td>
				<td>${carousel.remarks }</td>
				<shiro:hasPermission name="sys:carousel:edit"><td>
    				<a href="${ctx}/sys/carousel/edit?id=${carousel.id}">修改</a>
					<a href="${ctx}/sys/carousel/delete?id=${carousel.id}" onclick="return confirmx('确认要删除该轮播图吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
	<div style="display:none;" class="BoxDiv" id="showImgDiv">
		<img id="showImg" src="" style="width:300px;height:300px;">
		<div style="border-top:1px;">
			<input type="button" style="width: 300px;" value="关闭" onclick="closeImgDiv()">
		</div>
	</div>
</body>
</html>